package com.taotao.usercoupon.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.taotao.common.core.domain.Result;
import com.taotao.coupon.domain.Coupon;
import com.taotao.coupon.domain.UserCoupon;
import com.taotao.coupon.domain.result.PageResult;
import com.taotao.usercoupon.service.CouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * @ClassName CouponController
 * @Description 描述
 * @Author ChangLe.Liu
 * @Date 2025/1/13 20:25
 */
@RestController
@RequestMapping("/usercoupon")
public class CouponController {
    @Autowired
    private CouponService couponService;
    /**
     * 用户领取优惠卷
     *
     * @param
     * @return
     */
    @PostMapping("userCouponAdd/{couponId}")
    public Result userCouponAdd(@PathVariable Long couponId){
        couponService.userCouponAdd(couponId);
        Result<Object> result = Result.success();
        return result;
    }
    /**
     * 首页优惠券列表
     *
     * @param
     * @return
     */

    @GetMapping("/oneCouponList/{applyStatus}")
    public Result<List<Coupon>> oneCouponList(@PathVariable Integer applyStatus){
        List<Coupon> oneCouponList = couponService.oneCouponList(applyStatus);
        Result<List<Coupon>> result = Result.success(oneCouponList);
        return result;
    }
}
